import React, { Component } from 'react'
import styles from "../component/List.module.css"
import {withRouter} from "react-router-dom"
let obj={
  Forsale:"代售",
  Sold:'已售',
  Soldout:'售出',
  newproduct:'新产品'


}
export class List extends Component {

  render() {
    
 
    const{list}=this.props
    return (
      <div>
         <ul>{
          list.length ?list.map((item,index)=>{
            return <li key={index} onClick={
              ()=>{
                this.props.history.push("/detalis/"+item.id)
              }
            }> <img src={item.img}/> {item.title} <span className={styles[item.tag]}>{obj[item.tag]} </span>  </li>
          }):'暂无数据'
        }
        </ul> 
      </div>
    )
  }
}

export default withRouter(List)